<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex align-stretch benben-position-layout flex fapiao_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex align-center justify-between flex-sub fapiao_fd0_0'>
					<view class='flex align-center fapiao_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  fapiao_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex align-center'>
						<text class='fapiao_fd0_0_c1_c0'>发票详情</text>
					</view>
					<view class='flex align-center fapiao_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<view class="flex flex-direction align-stretch benben-flex-layout">
				<view class='flex flex-direction align-center fapiao_fd1_0'>
					<text class='fapiao_fd1_0_c0'>{{invoiceInfo.status_name}}</text>
					<view class='flex flex-wrap align-center'>
						<text class='fapiao_fd1_0_c1_c0'>{{$t('预计发票金额：￥')}}</text>
						<text class='flex-wrap align-center fapiao_fd1_0_c1_c1'>
							<text>{{ invoiceInfo.invoice_money | frontPrice }}</text>
							<text>{{ invoiceInfo.invoice_money | laterPrice }}</text>
						</text>
						<image class='fapiao_fd1_0_c1_c2' mode="aspectFit" :src='STATIC_URL+"256.png"'
							@tap.stop="popupShow1661508889761=true"></image>
					</view>
				</view>
				<view class='flex flex-direction align-center fapiao_fd1_1'>
					<text class='fapiao_fd1_1_c0'>电子普通发票</text>
					<view class='flex flex-wrap align-start fapiao_fd1_1_c1'>
						<view class='flex flex-direction flex-wrap align-center fapiao_fd1_1_c1_c0'>
							<image class='fapiao_fd1_1_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"133.png"'></image>
							<!-- <text class='fapiao_fd1_1_c1_c0_c1'>{{invoiceInfo.order_status}}</text> -->
							<text class='fapiao_fd1_1_c1_c0_c1'>待开发票</text>
						</view>
						<view class='flex flex-wrap align-center fapiao_fd1_1_c1_c1'>
						</view>
						<view class='flex flex-direction flex-wrap align-center fapiao_fd1_1_c1_c2'>
							<image class='fapiao_fd1_1_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"564.png"'
								v-if="invoiceInfo.status=='1'"></image>
							<image class='fapiao_fd1_1_c1_c0_c0' mode="aspectFit" :src='STATIC_URL+"133.png"'
								v-if="invoiceInfo.status=='2'"></image>
							<text class='fapiao_fd1_1_c1_c2_c1'>{{$t('开票完成')}}</text>
						</view>
					</view>
				</view>
				<view class='flex flex-wrap align-center fapiao_fd1_2'>
				</view>
				<view class='flex flex-direction align-stretch fapiao_fd1_3'>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0'>
						<text class='fapiao_fd1_3_c0_c0'>{{$t('发票类型')}}</text>
						<text class='fapiao_fd1_1_c0'>{{$t('电子普通发票')}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0'>
						<text class='fapiao_fd1_3_c0_c0'>{{$t('发票内容')}}</text>
						<text class='flex-sub fapiao_fd1_3_c1_c1'>{{invoiceInfo.content}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0'>
						<text class='fapiao_fd1_3_c0_c0'>{{$t('抬头类型')}}</text>
						<text class='flex-sub fapiao_fd1_3_c1_c1'
							v-if="invoiceInfo.header_type=='1'">{{$t('个人')}}</text><text
							class='flex-sub fapiao_fd1_3_c1_c1' v-if="invoiceInfo.header_type=='2'">{{$t('企业')}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0'>
						<text class='fapiao_fd1_3_c0_c0'>{{$t('发票抬头')}}</text>
						<text class='flex-sub fapiao_fd1_3_c1_c1'>{{invoiceInfo.name}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0' v-if="invoiceInfo.header_type=='2'">
						<text class='fapiao_fd1_3_c0_c0'>{{$t('公司税号')}}</text>
						<text class='flex-sub fapiao_fd1_3_c1_c1'>{{invoiceInfo.duty_number}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0'>
						<text class='fapiao_fd1_3_c0_c0'>{{$t('开票金额')}}</text>
						<text class='fapiao_fd1_3_c1_c1'>{{$t('¥')}}</text>
						<text class=' fapiao_fd1_3_c5_c2'>
							<text>{{ invoiceInfo.invoice_money | frontPrice }}</text>
							<text>{{ invoiceInfo.invoice_money | laterPrice }}</text>
						</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0' v-if="invoiceInfo.status=='2'">
						<text class='fapiao_fd1_3_c0_c0'>{{$t('开票时间')}}</text>
						<text class='flex-sub fapiao_fd1_3_c1_c1'>{{invoiceInfo.make_time}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c0' v-if=" invoiceInfo.status==1">
						<text class='fapiao_fd1_3_c0_c0'>{{$t('申请时间')}}</text>
						<text class='flex-sub fapiao_fd1_3_c1_c1'>{{invoiceInfo.create_time}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c8' v-if="invoiceInfo.status=='2'">
						<text class='fu-iconfont2  fapiao_fd1_3_c8_c0' @tap.stop="SavePictureFunc()">&#xe79c;</text>
						<text class='fapiao_fd1_3_c8_c1' @tap.stop="SavePictureFunc()">{{$t('下载发票')}}</text>
					</view>
					<view class='flex flex-wrap align-center fapiao_fd1_3_c8' v-if="invoiceInfo.status=='2'">
						<image class='fapiao_fd1_3_c9_c0' mode="aspectFill" :src='invoiceInfo.invoice_img'></image>
					</view>
				</view>
			</view>


			<benben-popup v-model="popupShow1661508889761" :mask="true" :mask-close-able="true" mode='bottom'>
				<!---发票说明flex布局开始-->
				<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout fapiao_flex_2">
					<view class='flex flex-wrap align-center fapiao_fd2_0'>
						<view class='flex flex-wrap align-center fapiao_fd2_0_c0'>
						</view>
						<image class='fapiao_fd2_0_c1' mode="aspectFit" :src='STATIC_URL+"566.png"'></image>
						<text class='fapiao_fd2_0_c2'>{{$t('发票说明')}}</text>
						<image class='fapiao_fd2_0_c3' mode="aspectFit" :src='STATIC_URL+"567.png"'></image>
						<image class='fapiao_fd2_0_c4' mode="aspectFit" :src='STATIC_URL+"260.png"'
							@tap.stop="popupShow1661508889761=false"></image>
					</view>

					<scroll-view class='fapiao_fd2_1' :scroll-y='true'>
						<view class='flex flex-direction align-stretch benben-scroll flex'>
							<jyf-parser class='fapiao_fd2_1_c0' :html="invoiceMse.body | richTextFormat">
							</jyf-parser>
						</view>
					</scroll-view>

				</view>

				<!---发票说明flex布局结束-->

			</benben-popup>


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"popupShow1661508889761": false,
				"cut": "1",
				"invoiceInfo": {
					"aid": "",
					"header_type": "",
					"duty_number": "",
					"name": "",
					"bank": "",
					"drawer_mobile": "",
					"email": "",
					"tel": "",
					"address": "",
					"type": "",
					"card_number": "",
					"status": "",
					"create_time": "",
					"invoice_money": "",
					"invoice_img": "",
					"make_time": "",
					"type_name": "",
					"status_name": "",
					"content": ""
				},
				"invoiceMse": {
					"aid": "",
					"title": "",
					"body": "",
					"create_time": ""
				},
				"order_sn": ""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			/**
			 * @returns 
			 * Android       安卓
			 * IOS       苹果
			 * Web       H5 或 pc
			 * Wechat       微信小程序
			 * Alipay       支付宝小程序
			 * Baidu       百度小程序
			 * ByteBounce       抖音小程序
			 * 360       360小程序
			 * FastApp       快应用
			 */
			appSystemIdentification() {
				return this.$store.state.appSystemIdentification
			}
		},
		watch: {},
		onLoad(options) {
			let {
				order_sn
			} = options
			if (order_sn !== undefined) this.order_sn = order_sn
			this.getInvoiceInfoFunc()
			this.getInvoiceProtocolFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//订单-发票详情
			async getInvoiceInfoFunc() {
				//请求方法
				//数据验证

				let datainvoiceInfo = await this.$api.get(global.apiUrls.post6531d7026c33a, {
					order_sn: this.order_sn
				});

				if (datainvoiceInfo.data.code != 1) {
					this.$message.info(datainvoiceInfo.data.msg);
					return
				}
				let infoinvoiceInfo = datainvoiceInfo.data;
				this.invoiceInfo = infoinvoiceInfo.data

			},
			//下载发票
			SavePictureFunc() {
				if (this.appSystemIdentification == 'IOS' || this.appSystemIdentification == 'Android') {
					uni.saveImageToPhotosAlbum({
						filePath: this.invoiceInfo.invoice_img,
						success: (res) => {
							console.log(res)
							this.$message.info(global.i18n.t('保存成功'))
							this.close()
						},
					})
				} else if (this.appSystemIdentification == 'Web') {
					uni.downloadFile({
						url: this.invoiceInfo.invoice_img,
						success: (res) => {
							console.log(res)
							if (res.statusCode === 200) {
								console.log('下载成功');
								var oA = document.createElement("a");
								oA.download = ''; // 设置下载的文件名，默认是'下载'
								oA.href = res.tempFilePath; //临时路径再保存到本地
								document.body.appendChild(oA);
								oA.click();
								oA.remove(); // 下载之后把创建的元素删除
							}

						}
					});
				} else if (this.appSystemIdentification == 'Wechat') {
					uni.getImageInfo({
						src: this.invoiceInfo.invoice_img,
						success: (res) => {
							uni.saveImageToPhotosAlbum({
								filePath: res.path,
								success: (ress) => {
									this.$message.info(this.$t('保存成功'))
								},
								fail: (err) => {
									console.log(err);
									this.$message.info(this.$t('保存失败'))
								}
							})
						}
					})
				}
			},
			//获取发票协议
			async getInvoiceProtocolFunc() {
				//请求方法
				//数据验证

				let datainvoiceMse = await this.$api.post(global.apiUrls.post636c78ae2216b, {
					aid: '26'
				});

				if (datainvoiceMse.data.code != 1) {
					this.$message.info(datainvoiceMse.data.msg);
					return
				}
				let infoinvoiceMse = datainvoiceMse.data;
				this.invoiceMse = infoinvoiceMse.data

			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(image-path('563.png')) no-repeat;
		background-size: 100% auto;
	}

	.fapiao_flex_0 {
		background: var(--benbenbgColor2);
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.fapiao_fd0_0_c1_c0 {
		color: var(--benbenFontColor3);
		font-size: 36rpx;
		font-weight: 500;
	}

	.fapiao_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #fff;
	}

	.fapiao_fd0_0_c0 {
		width: 180rpx;
	}

	.fapiao_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.fapiao_fd1_3_c9_c0 {
		width: 702rpx;
		height: 454rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.fapiao_fd1_3_c8_c1 {
		color: var(--benbenFontColor4);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 28rpx;
	}

	.fapiao_fd1_3_c8_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: var(--benbenFontColor4);
		margin: 0rpx 24rpx 0rpx 0rpx;
	}

	.fapiao_fd1_3_c8 {
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.fapiao_fd1_3_c5_c2 {
		color: #333333;
		font-weight: 400;
		line-height: 42rpx;
		font-size: 28rpx;
	}

	.fapiao_fd1_3_c1_c1 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.fapiao_fd1_3_c0_c0 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #999999;
		width: 136rpx;
	}

	.fapiao_fd1_3_c0 {
		padding: 16rpx 0rpx 16rpx 0rpx;
	}

	.fapiao_fd1_3 {
		background: var(--benbenbgColor1);
		background-size: 100% auto !important;
		padding: 16rpx 24rpx 016rpx 024rpx;
	}

	.fapiao_fd1_2 {
		height: 20rpx;
	}

	.fapiao_fd1_1_c1_c2_c1 {
		line-height: 42rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		margin: 16rpx 0rpx 0rpx 0rpx;
	}

	.fapiao_fd1_1_c1_c2 {
		margin: 0rpx 0rpx 0rpx -32rpx;
	}

	.fapiao_fd1_1_c1_c1 {
		background: rgba(238, 238, 238, 1);
		height: 1rpx;
		background-size: 100% auto !important;
		width: 232rpx;
		margin: 31rpx 0rpx 0rpx 0rpx;
	}

	.fapiao_fd1_1_c1_c0_c1 {
		line-height: 42rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #666666;
		margin: 16rpx 0rpx 0rpx 0rpx;
	}

	.fapiao_fd1_1_c1_c0_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.fapiao_fd1_1_c1_c0 {
		margin: 0rpx -32rpx 0rpx 0rpx;
	}

	.fapiao_fd1_1_c1 {
		margin: 42rpx 0rpx 0rpx 0rpx;
	}

	.fapiao_fd1_1_c0 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.fapiao_fd1_1 {
		background: var(--benbenbgColor1);
		border-radius: 16rpx 16rpx 0rpx 0rpx;
		background-size: 100% auto !important;
		padding: 40rpx 0rpx 32rpx 0rpx;
	}

	.fapiao_fd1_0_c1_c2 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.fapiao_fd1_0_c1_c1 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #FFFFFF;
	}

	.fapiao_fd1_0_c1_c0 {
		line-height: 42rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #FFFFFF;
	}

	.fapiao_fd1_0_c0 {
		line-height: 43rpx;
		font-size: 32rpx;
		font-weight: 700;
		color: #FFFFFF;
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.fapiao_fd1_0 {
		background: var(--benbenbgColor2);
		padding: 32rpx 0rpx 56rpx 0rpx;
		background-size: 100% auto !important;
	}

	.fapiao_flex_2 {
		background: #fff;
		background-size: 100% auto !important;
		border-radius: 24rpx 24rpx 0rpx 0rpx;
		padding: 0rpx 32rpx 64rpx 32rpx;
	}

	::v-deep .fapiao_fd2_1_c0 {
		width: 100%;
	}

	.fapiao_fd2_1 {
		touch-action: none;
		height: 400rpx;
		width: 680rpx;
	}

	.fapiao_fd2_0_c4 {
		width: 40rpx;
		height: 40rpx;
	}

	.fapiao_fd2_0_c3 {
		width: 32rpx;
		height: 10rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx auto 0rpx 0rpx;
	}

	.fapiao_fd2_0_c2 {
		margin: 0rpx 20rpx 0rpx 20rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
	}

	.fapiao_fd2_0_c1 {
		width: 32rpx;
		height: 10rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.fapiao_fd2_0_c0 {
		width: 26rpx;
	}

	.fapiao_fd2_0 {
		line-height: 129rpx;
	}
</style>